
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
babel-plugin-flow-react-proptypes
Advanced tools
A babel plugin to generate React PropTypes definitions from Flow type declarations.
With this input:
var React = require('react');
type FooProps = {
an_optional_string?: string,
a_number: number,
a_generic_object: Object,
array_of_strings: Array<string>,
instance_of_Bar: Bar,
anything: any,
one_of: 'QUACK' | 'BARK' | 5,
onw_of_type: number | string,
nested_object_level_1: {
string_property_1: string,
nested_object_level_2: {
nested_object_level_3: {
string_property_3: string,
},
string_property_2: string,
}
}
}
export default class Foo extends React.Component {
props: FooProps
}
The output will be:
var React = require('react');
var Foo = function (_React$Component) {
// babel class boilerplate
}(React.Component)
Foo.propTypes = {
an_optional_string: React.PropTypes.string,
a_number: React.PropTypes.number.isRequired,
a_generic_object: React.PropTypes.object.isRequired,
array_of_strings: React.PropTypes.arrayOf(React.PropTypes.string).isRequired,
instance_of_Bar: React.PropTypes.any.isRequired,
anything: React.PropTypes.any.isRequired,
one_of: React.PropTypes.oneOf(['QUACK', 'BARK', 5]).isRequired,
onw_of_type: React.PropTypes.oneOfType([React.PropTypes.number, React.PropTypes.string]).isRequired,
nested_object_level_1: React.PropTypes.shape({
string_property_1: React.PropTypes.string.isRequired,
nested_object_level_2: React.PropTypes.shape({
nested_object_level_3: React.PropTypes.shape({
string_property_3: React.PropTypes.string.isRequired
}).isRequired,
string_property_2: React.PropTypes.string.isRequired
}).isRequired
}).isRequired
};
exports.default = Foo;
This plugin searches for a React components using type declaration. Works with functional components, React.createClass
and ES6 classes.
First install the plugin:
npm install --save-dev babel-plugin-flow-react-proptypes
Then add it to your babelrc:
{
"presets": ["..."],
"plugins": ["flow-react-proptypes"]
}
To save some bytes in production, you can also only enable it in development mode.
{
"presets": ["..."],
"env": {
"development": {
"plugins": ["flow-react-proptypes"]
}
}
}
This plugin isn't perfect. You can disable it for an entire file with this directive (including quotes):
'no babel-plugin-flow-react-proptypes';
0.21.0
FAQs
converts flow types to react proptypes
The npm package babel-plugin-flow-react-proptypes receives a total of 17,103 weekly downloads. As such, babel-plugin-flow-react-proptypes popularity was classified as popular.
We found that babel-plugin-flow-react-proptypes demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.